import axios from "../src/utils/http";
//请求查看个人信息
export function getPersonal(){
    return axios.get("/api/pcUser/login-user/info")
}
//修改昵称
export function changeNickname(nickname){
    let obj = {
        "nickname":nickname
    }
    return axios.post("/api/pcUser/update/userInfo",obj)
}
//个人中心修改手机号获取验证码
export function changePhoneGetCode(phoneNum){
    return axios.get(`/api/pcUser/short-message/vcode/${phoneNum}`)
}
//个人中心修改手机号码
export function phoneChanging(phone,code){
    let obj ={
        "mobile":phone,
        "code":code
    }
    return axios.post("/api/pcUser/update/userMobile",obj)
}
//修改密码时发送验证码
export function sendCode(phone){
    return axios.get(`/api/pcUser/edit-password/send/code/${phone}`);
}
//个人中心修改密码
export function toChangePwd(old,newPwd,checkNew,phone,code){
    let obj = new URLSearchParams();
    obj.append("oldPassword",old);
    obj.append("newPassword",newPwd);
    obj.append("checkNewPassword",checkNew);
    obj.append("mobile",phone);
    obj.append("code",code);
    return axios.post("/api/pcUser/update/userPassword",obj)
}